package com.example.demo.trade.service.impl;

import java.time.LocalDateTime;

import org.springframework.stereotype.Service;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.example.demo.trade.service.TradeService;

@Service
public class TradeServiceImpl implements TradeService {

    @Override
    //    @SentinelResource(value = "TRADE_TEST_SERVICE", blockHandler = "testBlock")
    public String test() {
        String result = "请求成功. time: " + LocalDateTime.now();
        System.out.println(result);
        return result;
    }

    private String testBlock(BlockException e) {
        return "请求失败, 被限流. time: " + LocalDateTime.now();
    }

}
